package com.lagou.edu.service.impl;


import com.lagou.edu.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;




@Service
public class EmailServiceImpl implements EmailService {
    @Autowired
    private JavaMailSender javaMailSender;


    @Override
    public String sendEmail(String toEmailaddress,String content){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("验证码");
        message.setText("您的验证码为:" + content);
        message.setTo(toEmailaddress);
        message.setFrom("charwayh@sina.com");
        javaMailSender.send(message);
        return "success";
    }
}